package com.ai.spring.embedding;

import dev.langchain4j.data.embedding.Embedding;
import dev.langchain4j.model.openai.OpenAiEmbeddingModel;
import dev.langchain4j.model.output.Response;

/**
 * @author xp
 * @date 2024/10/21 14:32
 * @description
 */
public class EmbeddingTest {

    private final static String BASE_URL = "https://www.jcapikey.com/v1";

    public static void main(String[] args) {
        OpenAiEmbeddingModel model = OpenAiEmbeddingModel.builder()
                .baseUrl(BASE_URL)
                .apiKey("sk-L8Vfh8kKhU0DUsK52d4e6dFe920c4aCdA2Fc2d427dD8407b")
                .build();
        Response<Embedding> embeddingResponse = model.embed("你好，我是Calvin");
        System.out.println(embeddingResponse.content());
    }

}
